<?php
	$currentItem = "BulletinAdmin";
	$currentSubItem = "add";
?>
<include file="./Tpl/default/Admin/Public/header.html" />
<include file="./Tpl/default/Admin/Public/sidebar.html" />

<!--kindeditor-->
<script charset="utf-8" src="../Public/editor/kindeditor.js">
</script>

<script language="JavaScript">
	KE.show({
	    id : 'message'
	});

</script>
<!--End kindeditor-->

<script language="JavaScript">
	function addFileInput(){
		var newInput = document.createElement("input");
		newInput.type='file'; 
		newInput.name="affixFiles[]"; 
		
		var isFileInput = document.createElement("input");
		isFileInput.type='hidden'; 
		isFileInput.name="isFile";
		isFileInput.value="true";
				
		var fileDiv =document.getElementById("fileDiv")
		fileDiv.appendChild(newInput); 
		fileDiv.appendChild(isFileInput); 
	}
	
	//用于添加公告的子类型select	
	$(document).ready(function(){
		
		$('#type').change(
			function(){
				if($('#type option:selected').val() == 2){
					var htmlString = '<select name="subtype" id="subtype">' + 
									 '<option value="0">课程表</option>' + 
									 '<option value="1">教务通知</option>' +
									 '<option value="2">学籍管理</option>' +
									 '</select>';
									 
					 $('#subtypeDiv').append(htmlString);
					 
				}else{
					$('#subtype').remove();
			
				}
				
			});		
	});
</script>

<div>
	<h2>添加公告页面</h2>
	
	<br>
	
	<!--	支持文件附件上传	-->
	<form id="BulletinForm" method="post" enctype="multipart/form-data" action="__APP__/Admin/BulletinAdmin/insertBulletin">
	
		<div id="result" style="font-family:微软雅黑,Tahoma;letter-spacing:2px">
		</div>
		<ul>

			<li>
				<label>选择发布的公告类型</label>
				<select name="type" id="type">
					<option value="0">学院通知</option>
					<option value="1">研究生事务</option>
					<option value="2">本科生事务</option>
					<option value="3">科研通知</option>
				</select>	
			
			</li>
			
		<!--	产生公告子类型区域		-->
			<li>
				<div id="subtypeDiv"></div>
			</li>
			
		<!--	文件上传列表		-->
		
			<li>
				<div id="fileDiv">
					<input type="button" onclick="addFileInput()" value="添加附件">
				</div>
				
			</li>
					
			<li>
				<label>标题：</label>
				<input type="text" name="title" >
			</li>
			
			<li>
				<label>副标题：</label>
				<input type="text" name="subtitle" >
			</li>
			
			
			<li>
				
				<textarea id="message"
						  name="message"
						  style="width:700px;height:300px;">
			 		   
			 		   &lt;strong&gt;HTML内容&lt;strong&gt;   
			 	</textarea>			
			</li>

			<li>
				<input type="hidden" value="<?php echo $_SESSION['real_name']?>" name="publisher">

				<input type="submit" value="提 交">
				<input type="reset" >
				<strong><a href="__APP__/Admin/BulletinAdmin/">返回</a></strong>
			</li>
			
		</ul>

	</form>

</div>

<include file="./Tpl/default/Admin/Public/footer.html" />
